﻿@{
    Layout = "_LayoutalertForm";
    ViewData["title"] = "模块添加";
}

<form id="form1">
    <input type="hidden" name="ModuleId" id="ModuleId" value="@ViewData["ModuleId"]" />
    <input type="hidden" name="ParentId" id="ParentId" value="@ViewData["ParentId"]" />
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">名称</th>
                <td class="formValue">
                    <input id="FullName" name="FullName" type="text" class="form-control required" maxlength="50" placeholder="请输入名称" />
                </td>
                <th class="formTitle">位置</th>
                <td class="formValue">
                    <select id="Location" name="Location" class="form-control required">
                        <option value="">==请选择==</option>
                        <option value="1">初始</option>
                        <option value="2">选中</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">连接</th>
                <td class="formValue" colspan="3">
                    <input id="UrlAddress" name="UrlAddress" type="text" class="form-control required" maxlength="100" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">图标</th>
                <td class="formValue">
                    <div class="input-group">
                        <input id="Icon" name="Icon" type="text" class="form-control"  maxlength="20" />
                        <span class="input-group-btn">
                            <a class="btn  btn-primary"><i class="fa fa-ellipsis-h"></i></a>
                        </span>
                    </div>
                </td>
                <th class="formTitle">排序</th>
                <td class="formValue">
                    <input id="SortCode" name="SortCode" type="text" value="1" class="form-control required number" max="9999"  placeholder="请输入排序" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" style="height: 35px;">选项</th>
                <td class="formValue" colspan="3" style="padding-top: 1px;">
                    <div class="ckbox">
                        <input id="Split" name="Split" type="checkbox"><label for="Split">分开线</label>
                    </div>
                    <div class="ckbox">
                        <input id="IsPublic" name="IsPublic" type="checkbox"><label for="IsPublic">公共</label>
                    </div>
                    <div class="ckbox">
                        <input id="IsEnabled" name="IsEnabled" type="checkbox" checked="checked"><label for="IsEnabled">有效</label>
                    </div>

                    <div class="ckbox">
                        <input id="AllowEdit" name="AllowEdit" type="checkbox"><label for="AllowEdit">允许编辑</label>
                    </div>
                    <div class="ckbox">
                        <input id="AllowDelete" name="AllowDelete" type="checkbox"><label for="AllowDelete">允许删除</label>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 5px;">
                    备注
                </th>
                <td class="formValue" colspan="3">
                    <textarea id="Description" name="Descriptions" class="form-control" maxlength="100" style="height: 50px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>

@section scripts{
<script type="text/javascript">
    $(function () {
        initControl();
    });

    function initControl() {
        $("#Location").select2({ minimumResultsForSearch: -1 });
        $("#form1").formValid()
    }

    function submitForm() {
        if (!$("#form1").valid()) {
            return false;
        }

        var target = "body";
        //当前模态窗口 外层div的id
        var mp = top.$('#ModuleButtonCreate').parent();
        if (mp != undefined)
            target = "#" + mp.attr("id");
 
        $.fn.submitForm({
            //loading参数 start
            target: target,
            message: '正在保存数据...',
            //loading参数 end
            url: "/ModuleButton/Create",
            param: $("#form1").formSerialize(),
            success: function () {
                var index = top.$('#moduleBtns > iframe').index("iframe");
                top.frames[index].$('#table').bootstrapTable('refresh');
            }
        });
    };
</script>
}